﻿using System;

namespace Generator
{
    public delegate object Function(params object[] args);

    [AttributeUsage(AttributeTargets.Method)]
    class FuncDescriptionAttribute : Attribute
    {
        FuncDescriptionAttribute(int numParams)
        {
            NumParams = numParams;
        }

        public int NumParams { get; private set; }
    }

    interface IFuncs
    {
        object Return(object a);

        object Const(int a);
        object Param(object[] paramsList, int number);
        object ElemInt(object list, object number);
        object ElemList(object list, object number);
        object Add(object a, object b);
        object Sub(object a, object b);
        object Mul(object a, object b);
        object Div(object a, object b);

        object MakePair(object a, object b);
        object MakeClosure(string name, Function func);

        object Call(Function func, params object[] args);

        object IfEqual(object a, object b);
        object IfGreater(object a, object b);
        object IfGreaterOrEqual(object a, object b);
        object Select(object cond, object ifTrue, object ifFalse);

        void Flush();
    }
}
